package com.dao.impl;

import java.util.List;

import com.dao.UserDao;
import com.entity.User;
import com.util.BaseDao;

public class UserDaoImpl implements UserDao{

	BaseDao<User>baseDao =new BaseDao<User>();
	
	public List<User> login(String name,String password){
		
		List<User>list=baseDao.query("select * from user where name=? and password=?", new Object[]{name,password}, User.class);
		return list;
	}
	public boolean register(User user){
		boolean flag=baseDao.executeSQL("insert into user(name,password) value(?,?)",new Object[]{user.getName(),user.getPassword()});
		return flag;
	}
	public List<User> findUserByName(String name){
		List<User>list=baseDao.query("select * from user where name=?", new Object[]{name}, User.class);
		return list;
		
	}
}
